{extends file = "assets::smarty-templates::DetailsView"|ToPath}

{block name="title"}Usuarios / Ver{/block}

{block name="page-id"}usuarios-view-page{/block}

{block name="custom-actions"}
{*<li>
    
</li>*}
{/block}

{block name="entityActions"}

{/block}

{block name="entityDetails"}
<h3>{$user}</h3>
<ul data-role="listview" data-inset="true" data-split-icon="delete" data-split-theme="c">
    <li data-role="list-divider">
        Roles asociados
    </li>
    {foreach $roles as $rol}
        <li>
            <a>
                {$rol->getNombre()}
            </a>
            <a class="quitar-rol" data-id="{$rol->getIdRol()}">Quitar rol</a>
        </li>
    {/foreach}
    <li data-role="fieldcontain">
        <form method="post" action="{$action}" data-transition="none">
            <input type="hidden" value="{$user}" name="id" />
            <select data-native-menu="false" name="idRol">
                <option data-placefolder="true">Agregar un rol</option>
                {foreach $rolesDisponibles as $rol}
                    <option value="{$rol->getIdRol()}">{$rol->getNombre()}</option>
                {/foreach}
            </select>
        </form>
    </li>
</ul>

<div>
    <a id="delete-usuario"
       data-icon="delete" 
       data-role="button">
        Eliminar
    </a>
    <div style="display: none" class="confirm-strip">
        <form method="post" action="{$removeAction}">
            <hr />
            <input type="hidden" value="{$user}" name="id" />
            <div>
                <p>
                    Está seguro que desea eliminar este usuario?
                </p>
            </div>
            <div>
                <a href="#" 
                   data-role="button" 
                   id="confirm-cancel-button"
                   data-inline="true"
                   class="ui-btn-right">Cancelar</a>
                <button data-icon="check" 
                        type="submit" 
                        data-inline="true" 
                        class="ui-btn-right"
                        data-theme="b">Eliminar</button>
            </div>
            <hr />
        </form>
    </div>
</div>

<form id="remove-role-action" action="{$removeRoleAction}" method="post" style="display: none" data-transition="none">
    <input type="hidden" value="" name="idRol" />
    <input type="hidden" value="{$user}" name="id" />
</form>
{/block}